package com.cc.service;

import com.cc.mapper.EbNewsMapper;
import com.cc.model.EbNews;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 用一句话描述
 * @Auther: 新梦想*陈超
 * @Date: 2020-10-29 16:45
 */
@Service
public class NewsService {

    @Autowired
    private EbNewsMapper ebNewsMapper;

    /**
     * 分页查询新闻信息
     * @param page
     * @param pageSize
     * @return
     */

    //1.定义一个分页查询新闻方法  手动导包：alt+enter
    public List<EbNews> list(int page,int pageSize){
        //1、调用EbNews分页查询新闻数据
        PageHelper.startPage(page,pageSize);
        List<EbNews> ebNews = ebNewsMapper.selectByExample(null);
        return ebNews;
    }

    public EbNews findById(int enId) {
        return ebNewsMapper.selectByPrimaryKey(enId);
    }
}
